import request from "@/utils/request"

export default{
    // 分页
    search(page, size, searchMap){
        return request({
            url: `/goods/list/search/${page}/${size}`,
            method: 'post',
            data: searchMap
        })
    },
    // 添加商品
    add(pojo){
        return request({
            url: '/goods',
            method: 'post',
            data: pojo
        })
    },
    // 根据id获取商品信息
    getById(id){
        return request({
            url: `/goods/${id}`,
            method: 'get'
        })
    },
    // 更新商品信息
    update(pojo){
        return request({
            url: `/goods/${pojo.id}`,
            method: 'put',
            data: pojo
        })
    },
    // 删除商品信息
    deleteById(id){
        return request({
            url: `/goods/${id}`,
            method: 'delete',
        })
    }
}